<?php namespace OAuth2\Server\Exception;

/**
 * OAuth2.0 draft v10 exception handling.
 *
 * @author Originally written by Naitik Shah <naitik@facebook.com>.
 * @author Update to draft v10 by Edison Wong <hswong3i@pantarei-design.com>.
 *
 * @sa <a href="https://github.com/facebook/php-sdk">Facebook PHP SDK</a>.
 */
class Authentication extends \Exception {


    protected $_httpStatusCode;
    protected $_realm;
    protected $_error;
    protected $_errorDescription;
    protected $_errorUri;
    protected $_scope;

    /**
    * Make a new API Exception with the given result.
    *
    * @param $result
    *   The result from the API server.
    */
    public function __construct($httpStatusCode, $realm, $error, $errorDescription, $errorUri = null, $scope = null) 
    {
    $this->_httpStatusCode = $httpStatusCode;
    $this->_realm = $realm;
    $this->_error = $error;
    $this->_errorDescription = $errorDescription;
    $this->_errorUri = $errorUri;
    $this->_scope = $scope;
    parent::__construct($errorDescription);
    }
  
    public function getRealm()      {
     return $this->_realm;
    }

    public function setRealm($realm)
    {
     $this->_realm = $realm;
    }

    public function getScope()
    {
     return $this->_scope;
    }

    public function setScope($scope)
    {
     $this->_scope = $scope;
    }
    
    /**
    * httpStatusCode getter
    *
    * @returns string
    */
    public function getHttpStatusCode() 
    {
    return $this->_httpStatusCode;
    }

    /**
    * _errorUri getter
    *
    * @returns string
    */
    public function getErrorUri() 
    {
    return $this->_errorUri;
    }

    public function getError() 
    {
      return $this->_error;
    }

    public function setError($error)
    {
        $this->_error = $error;
    }
}
